             package com.java.diagnostics.visualizer.recommender.balanced;
             
             import com.java.diagnostics.visualizer.data.AggregateData;
             import com.java.diagnostics.visualizer.data.DataPoint;
             import com.java.diagnostics.visualizer.data.TupleData;
             import com.java.diagnostics.visualizer.parser.vgc.constants.VGCGCReasons;
             import com.java.diagnostics.visualizer.recommender.Recommendation;
             import com.java.diagnostics.visualizer.recommender.RecommendationBase;
             import com.java.diagnostics.visualizer.recommender.util.RecommendationLabels;
             
             public class CalculateCollectionCounts
               extends RecommendationBase
               implements Recommendation
             {
               public void recommend(AggregateData data)
               {
                 TupleData reasonData = data.getTupleData("VGCLabels.gc.reasons");
                 
                 if (reasonData != null)
                 {
                   DataPoint[] reasons = reasonData.getDataPoints();
                   
                   int afTotal = 0;
                   int conTotal = 0;
                   int sysTotal = 0;
                   int fullTotal = 0;
                   
                   for (int i = 0; i < reasons.length; i++) {
                     Double reason = Double.valueOf(reasons[i].getRawY());
                     if (reason.doubleValue() == VGCGCReasons.AF_INT) {
                       afTotal++;
                     } else if (reason.doubleValue() == VGCGCReasons.CON_INT) {
                       conTotal++;
                     } else if (reason.doubleValue() == VGCGCReasons.SYS_INT) {
                       sysTotal++;
                     } else if (reason.doubleValue() == VGCGCReasons.FULL_INT) {
                       fullTotal++;
                     }
                   }
                   
                   addToSummary(data, RecommendationLabels.ALLOCATION_FAILURE_COUNT, 
                     Integer.valueOf(afTotal));
                   if ((isConcurrent(data)) || (conTotal > 0)) {
                     addToSummary(data, 
                       RecommendationLabels.CONCURRENT_COLLECTION_COUNT, 
                       Integer.valueOf(conTotal));
                   }
                   addToSummary(data, RecommendationLabels.FORCED_COLLECTION_COUNT, 
                     Integer.valueOf(sysTotal));
                   if ((isSun(data)) || (fullTotal > 0)) {
                     addToSummary(data, RecommendationLabels.FULL_COLLECTION_COUNT, 
                       Integer.valueOf(fullTotal));
                   }
                 }
               }
             }


